package leetcode;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2022-02-24 18:17
 **/
public class LeetCode2176 {

    public int countPairs(int[] nums, int k) {
        int n = nums.length;
        int count = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; ++j) {
                if (nums[i] == nums[j] && i *j % k == 0) {
                    ++count;
                }
            }
        }
        return count;
    }


}
